package com.mtsmda.ws.rest.services;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import com.mtsmda.ws.rest.services.pojo.Person;

@Path("/json")
public class JSONService {
	
	@GET
	@Path("/get")
	@Produces(MediaType.APPLICATION_JSON)
	public Person getPersonInJSON(){
		Person person = new Person();
		person.setIdPerson(15);
		person.setFirstName("Mynzat");
		person.setLastName("Dmitrii");
		
		return person;		
	}
	
	@POST
	@Path("/post")
	@Consumes(MediaType.APPLICATION_JSON)
	public Response postPersonInJSON(Person person){
		String result = "Person ----- " + person;
		return Response.status(201).entity(result).build();
	}
	
}